class GameState {
  final List<RunBean> runList;
  final List<String> numberList;
  final List<BetBean> consoleList;
  final List<BetBean> buttonList;
  final List<int> betList;
  final List<int> lastBetList;
  int credit;
  int bonusWin;
  int tempBonusWin;
  int lastIndex;
  int sizeNumber;

  GameState({List<RunBean>? runList, List<String>? numberList, List<BetBean>? consoleList, List<BetBean>? buttonList, List<int>? betList, List<int>? lastBetList, this.credit = 999, this.bonusWin = 0, this.tempBonusWin = 0, this.lastIndex = 0, this.sizeNumber = 0}) : runList = runList ?? [], numberList = numberList ?? [], consoleList = consoleList ?? [], buttonList = buttonList ?? [], betList = betList ?? [], lastBetList = lastBetList ?? [];

  GameState copyWith({List<RunBean>? runList, List<String>? numberList, List<BetBean>? consoleList, List<BetBean>? buttonList, List<int>? betList, List<int>? lastBetList, int? credit, int? bonusWin, int? tempBonusWin, int? lastIndex, int? sizeNumber}) {
    return GameState(runList: runList ?? this.runList, numberList: numberList ?? this.numberList, consoleList: consoleList ?? this.consoleList, buttonList: buttonList ?? this.buttonList, betList: betList ?? this.betList, lastBetList: lastBetList ?? this.lastBetList, credit: credit ?? this.credit, bonusWin: bonusWin ?? this.bonusWin, tempBonusWin: tempBonusWin ?? this.tempBonusWin, lastIndex: lastIndex ?? this.lastIndex, sizeNumber: sizeNumber ?? this.sizeNumber);
  }
}

class RunBean {
  final String name;

  ///位置
  final int position;
  final double left;
  final double top;

  ///图片资源
  final String imgRes;

  ///类型
  final int tag;

  ///赔率
  final int price;

  RunBean({required this.name, required this.position, required this.imgRes, required this.tag, required this.price, required this.left, required this.top});
}

class BetBean {
  final String name;

  /// 图片资源
  final String normalImage;
  final String pressedImage;
  final String disabledImage;

  /// 是否可以点击
  final bool enabled;
  final double width;

  BetBean({required this.name, required this.normalImage, required this.pressedImage, required this.disabledImage, required this.enabled, required this.width});

  Map<String, dynamic> toJson() {
    return {'name': name, 'normalImage': normalImage, 'pressedImage': pressedImage, 'disabledImage': disabledImage, 'enabled': enabled, 'width': width};
  }

  factory BetBean.fromJson(Map<String, dynamic> json) {
    return BetBean(name: json['name'] as String, normalImage: json['normalImage'] as String, pressedImage: json['pressedImage'] as String, disabledImage: json['disabledImage'] as String, enabled: json['enabled'] as bool, width: json['width'] is num ? (json['width'] as num).toDouble() : 0.0);
  }

  BetBean copyWith({String? name, String? normalImage, String? pressedImage, String? disabledImage, bool? enabled, double? width}) {
    return BetBean(name: name ?? this.name, normalImage: normalImage ?? this.normalImage, pressedImage: pressedImage ?? this.pressedImage, disabledImage: disabledImage ?? this.disabledImage, enabled: enabled ?? this.enabled, width: width ?? this.width);
  }
}
